package org.sundatagroup.aurora.show.entity.status;

import java.time.Instant;

import org.springframework.web.socket.WebSocketSession;

/**
 * <p>后台储存的展示的状态信息封装类, 包括当前状态和 websocket 连接的 session
 * </p>
 * 
 * @version 0.2.0
 * <br>补充成员 pid 用于存放正在播放的工程. 未确定是否保留
 * 
 * @author lui
 * @author Zdream
 * @date 2018-05-25
 * @since 0.1.1
 */
public class StatusAndSession {
    private WebSocketSession socketSession;
    private IStatusEntity status;
    
    /**
     * 最后确定该展示屏存在、状态改变的时间戳
     */
    private Instant timestamp;
    
    /**
     * 是否处于连接状态
     */
    private boolean connect;
    
    /**
     * 缓存: 要播放的 project id
     * <br>-1, 表示无
     */
    private int pid = -1;

	public StatusAndSession(IStatusEntity status, WebSocketSession socketSession, boolean connect) {
		this.socketSession = socketSession;
		this.status = status;
		this.timestamp = Instant.now();
		this.connect = connect;
	}

    public Boolean isConnect() {
        return connect;
    }

    public void setConnect(boolean connect) {
        this.connect = connect;
    }
    
    public Instant getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Instant in) {
        this.timestamp = in;
    }

    public WebSocketSession getSocketSession() {
        return socketSession;
    }

    public void setSocketSession(WebSocketSession socketSession) {
        this.socketSession = socketSession;
    }

    public IStatusEntity getStatus() {
        return status;
    }

    public void setStatus(IStatusEntity status) {
        this.status = status;
    }

	public int getPid() {
		return pid;
	}

	public void setPid(int pid) {
		this.pid = pid;
	}
	
	public void cleanPid() {
		this.pid = -1;
	}
}
